package com.ruoyi.jpbi.service.impl;

import com.ruoyi.jpbi.domain.konggu.Tree;
import com.ruoyi.jpbi.domain.konggu.Departments;
import com.ruoyi.jpbi.mapper.DepartmentsMapper;
import com.ruoyi.jpbi.mapper.OrgnMapper;
import com.ruoyi.jpbi.service.DepartmentsService;

import com.ruoyi.jpbi.util.TreeBulid;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class DepartmentsServiceImpl implements DepartmentsService {
    @Autowired
    DepartmentsMapper departmentsMapper;

    @Autowired
    OrgnMapper orgnMapper;


    @Override
    public List<String> findSubdepartmentID(List<String> AllID) {
        return departmentsMapper.findSubdepartmentID(AllID);
    }

    @Override
    public Tree<T> findAllTree(List<String> AllID,String CompID,String type) {
        return TreeBulid.build(orgnMapper.findAllTree(AllID,CompID,type));
    }

    @Override
    public List<Departments> findAllDepa(String id,String type,Departments departments) {
        return departmentsMapper.findAllDepa(id,type,departments);
    }
    @Override
    public Departments findDepaone(String depID) {
        return departmentsMapper.findDepaone(depID);
    }

    @Override
    public int updateDepa(Departments departments) {
        return departmentsMapper.updateDepa(departments);
    }

    @Override
    public int insertDepa(Departments departments) {
        return departmentsMapper.insertDepa(departments);
    }

    @Override
    public int deleteDepa(List<String> depidList) {
        return departmentsMapper.deleteDepa(depidList);
    }
}
